package info.itloser.learnkotlindemo.ui.example

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import info.itloser.learnkotlindemo.R
import info.itloser.learnkotlindemo.adapter.ChatMessageAdapter
import info.itloser.learnkotlindemo.bean.ChatMessage
import info.itloser.learnkotlindemo.databinding.ActivityChatBinding


class ChatActivity : AppCompatActivity() {

    private lateinit var binding: ActivityChatBinding

    private val messages = ArrayList<ChatMessage>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityChatBinding.inflate(layoutInflater)
        setContentView(binding.root)

        //添加一些模拟消息
        messages.add(ChatMessage("在吗？大师决斗可垃圾的垃圾的啦 卡大大", ChatMessage.TYPE_SEND))
        messages.add(ChatMessage("在 大大大大大帅", ChatMessage.TYPE_RECEIVED))
        messages.add(ChatMessage("在干嘛？ 就够累的解耦股明刚开始可观看", ChatMessage.TYPE_SEND))
        messages.add(ChatMessage("在宅 额盘面上看哈克干啥个人能飒飒", ChatMessage.TYPE_RECEIVED))
        messages.add(ChatMessage("多喝热水 破了盔甲，打开了过考虑搭建浪费时间", ChatMessage.TYPE_SEND))
        messages.add(ChatMessage("好", ChatMessage.TYPE_RECEIVED))
        messages.add(ChatMessage("好 大手大脚咖喱豆腐公交卡代理费管家婆让你颠覆考虑你到拉萨就路飞倒计时了个等级", ChatMessage.TYPE_RECEIVED))

        binding.rvMain.layoutManager = LinearLayoutManager(this)
        binding.rvMain.adapter = ChatMessageAdapter(messages)


    }
}